import request from "@/utils/request.ts";
import type {recordsInter, trademarkInter} from "@/api/product/trademark/type.ts";
import type {ResponseInter} from "@/api/commonInterFace.ts";

enum Api {
    trademark_url = '/admin/product/baseTrademark',
    trademark_url_add = '/admin/product/baseTrademark/save',
    trademark_url_update = '/admin/product/baseTrademark/update',
    trademark_url_delete = '/admin/product/baseTrademark/remove'
}

export const reqTrademarkList = (page: number, limit: number) => request.get<string, trademarkInter>(`${Api.trademark_url}/${page}/${limit}`)

export const reqTrademarkAddOrUpdate = (data: recordsInter) => {
    if (data.id) {
        return request.put<string, ResponseInter>(Api.trademark_url_update, data)
    } else {
        return request.post<string, ResponseInter>(Api.trademark_url_add, data)
    }
}

export const reqTrademarkDelete = (id: number) => request.delete<string, ResponseInter>(`${Api.trademark_url_delete}/${id}`)
